package com.elai.overview.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.elai.common.annotation.Log;
import com.elai.common.core.controller.BaseController;
import com.elai.common.core.domain.AjaxResult;
import com.elai.common.enums.BusinessType;
import com.elai.overview.domain.MyOverviewPageMarkRela;
import com.elai.overview.service.IMyOverviewPageMarkRelaService;
import com.elai.common.utils.poi.ExcelUtil;
import com.elai.common.core.page.TableDataInfo;

/**
 * 书签与概览页面关联Controller
 * 
 * @author elai
 * @date 2021-09-19
 */
@RestController
@RequestMapping("/overview/markrela")
public class MyOverviewPageMarkRelaController extends BaseController
{
    @Autowired
    private IMyOverviewPageMarkRelaService myOverviewPageMarkRelaService;

    /**
     * 查询书签与概览页面关联列表
     */
    @PreAuthorize("@ss.hasPermi('overview:markrela:list')")
    @GetMapping("/list")
    public TableDataInfo list(MyOverviewPageMarkRela myOverviewPageMarkRela)
    {
        startPage();
        List<MyOverviewPageMarkRela> list = myOverviewPageMarkRelaService.selectMyOverviewPageMarkRelaList(myOverviewPageMarkRela);
        return getDataTable(list);
    }

    /**
     * 导出书签与概览页面关联列表
     */
    @PreAuthorize("@ss.hasPermi('overview:markrela:export')")
    @Log(title = "书签与概览页面关联", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(MyOverviewPageMarkRela myOverviewPageMarkRela)
    {
        List<MyOverviewPageMarkRela> list = myOverviewPageMarkRelaService.selectMyOverviewPageMarkRelaList(myOverviewPageMarkRela);
        ExcelUtil<MyOverviewPageMarkRela> util = new ExcelUtil<MyOverviewPageMarkRela>(MyOverviewPageMarkRela.class);
        return util.exportExcel(list, "书签与概览页面关联数据");
    }

    /**
     * 获取书签与概览页面关联详细信息
     */
    @PreAuthorize("@ss.hasPermi('overview:markrela:query')")
    @GetMapping(value = "/{markId}")
    public AjaxResult getInfo(@PathVariable("markId") Long markId)
    {
        return AjaxResult.success(myOverviewPageMarkRelaService.selectMyOverviewPageMarkRelaById(markId));
    }

    /**
     * 新增书签与概览页面关联
     */
    @PreAuthorize("@ss.hasPermi('overview:markrela:add')")
    @Log(title = "书签与概览页面关联", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody MyOverviewPageMarkRela myOverviewPageMarkRela)
    {
        return toAjax(myOverviewPageMarkRelaService.insertMyOverviewPageMarkRela(myOverviewPageMarkRela));
    }

    /**
     * 修改书签与概览页面关联
     */
    @PreAuthorize("@ss.hasPermi('overview:markrela:edit')")
    @Log(title = "书签与概览页面关联", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody MyOverviewPageMarkRela myOverviewPageMarkRela)
    {
        return toAjax(myOverviewPageMarkRelaService.updateMyOverviewPageMarkRela(myOverviewPageMarkRela));
    }

    /**
     * 删除书签与概览页面关联
     */
    @PreAuthorize("@ss.hasPermi('overview:markrela:remove')")
    @Log(title = "书签与概览页面关联", businessType = BusinessType.DELETE)
	@DeleteMapping("/{markIds}")
    public AjaxResult remove(@PathVariable Long[] markIds)
    {
        return toAjax(myOverviewPageMarkRelaService.deleteMyOverviewPageMarkRelaByIds(markIds));
    }
}
